libxl: move a lot more includes into libxl_internal.h
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 13 Jan 2012 16:54:19 +0000 (16:54 +0000)
committerIan Jackson <ian.jackson@eu.citrix.com>
Fri, 13 Jan 2012 16:54:19 +0000 (16:54 +0000)
Move a lot of
  #include <stdfoo.h>
from individual files into libxl_internal.h.  This helps avoid
portability mistakes where necessary system headers are omitted from
individual files, and is also of course a convenience when developing.

Also add
  #include "libxl_osdeps.h" /* must come before any other headers */
to the top of most libxl*.c files, so that anyone who adds any headers
before libxl_internal.h will put the in the right place.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
27 files changed:
tools/libxl/libxl.c
tools/libxl/libxl_blktap2.c
tools/libxl/libxl_bootloader.c
tools/libxl/libxl_cpuid.c
tools/libxl/libxl_create.c
tools/libxl/libxl_device.c
tools/libxl/libxl_dm.c
tools/libxl/libxl_dom.c
tools/libxl/libxl_exec.c
tools/libxl/libxl_flask.c
tools/libxl/libxl_internal.c
tools/libxl/libxl_internal.h
tools/libxl/libxl_json.c
tools/libxl/libxl_linux.c
tools/libxl/libxl_netbsd.c
tools/libxl/libxl_noblktap2.c
tools/libxl/libxl_nocpuid.c
tools/libxl/libxl_paths.c
tools/libxl/libxl_pci.c
tools/libxl/libxl_qmp.c
tools/libxl/libxl_utils.c
tools/libxl/libxl_uuid.c
tools/libxl/libxl_xshelp.c
tools/libxl/libxlu_cfg.c
tools/libxl/libxlu_cfg_i.h
tools/libxl/libxlu_disk.c
tools/libxl/libxlu_disk_i.h

index 3c086d56558f20950acd4f3d8853ec9ba7aff182..6e3c5a872dbdc36889c1d07a572fb924ee0d3f37 100644 (file)
 
 #include "libxl_osdeps.h"
 
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/select.h>
-#include <sys/wait.h>
-#include <sys/time.h>
-#include <signal.h>
-#include <unistd.h> /* for write, unlink and close */
-#include <stdint.h>
-#include <inttypes.h>
-#include <assert.h>
-
 #include "libxl_internal.h"
 
 #define PAGE_TO_MEMKB(pages) ((pages) * 4)
index acf4110ea82611061b7e2884c17d0dcacb623873..2c40182057413075d793783f4840283e3b7715d4 100644 (file)
  * GNU Lesser General Public License for more details.
  */
 
-#include "libxl_osdeps.h"
+#include "libxl_osdeps.h" /* must come before any other headers */
 #include "libxl_internal.h"
 
 #include "tap-ctl.h"
 
-#include <string.h>
-
 int libxl__blktap_enabled(libxl__gc *gc)
 {
     const char *msg;
index ce83b8eb47d2331f3a14c00865218d938a147784..2da1d90f340acecaa0a442ecc124d65478490f1a 100644 (file)
  * GNU Lesser General Public License for more details.
  */
 
-#include "libxl_osdeps.h"
+#include "libxl_osdeps.h" /* must come before any other headers */
 
-#include <unistd.h>
-#include <fcntl.h>
 #include <termios.h>
 
-#include <sys/stat.h>
-#include <sys/types.h>
-
 #include "libxl_internal.h"
 
 #define XENCONSOLED_BUF_SIZE 16
index 56a00cdf382c7fcb2bdc6940f00b8c23bc4c6c61..dcdb9d02165f25abee77d652e520c6f7a9fb6e1e 100644 (file)
@@ -10,6 +10,8 @@
  * GNU Lesser General Public License for more details.
  */
 
+#include "libxl_osdeps.h" /* must come before any other headers */
+
 #include "libxl_internal.h"
 
 void libxl_cpuid_dispose(libxl_cpuid_policy_list *p_cpuid_list)
index 815ee7951bd3778f7537c82d6801566b1834d15f..e1c615fb6017003d8fcf6ba99ae7b2b415c7131d 100644 (file)
  * GNU Lesser General Public License for more details.
  */
 
-#include "libxl_osdeps.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <xenctrl.h>
-#include <xc_dom.h>
-#include <xenguest.h>
-#include <assert.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
 
 #include "libxl_internal.h"
 
+#include <xc_dom.h>
+#include <xenguest.h>
+
 void libxl_domain_config_dispose(libxl_domain_config *d_config)
 {
     int i;
index 9b1fc5789cdeafca0097c14f648346013c8f05a9..5d05e90cb43be281392aef8cf88158dc2adb34ad 100644 (file)
  * GNU Lesser General Public License for more details.
  */
 
-#include "libxl_osdeps.h"
-
-#include <string.h>
-#include <stdio.h>
-#include <sys/time.h> /* for struct timeval */
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
 
 #include "libxl_internal.h"
 
index 3ebd806522fcc697c5e989bf0b3892818a2ead5c..cf84dabf69d963a29377456596285cc88af84db6 100644 (file)
  * GNU Lesser General Public License for more details.
  */
 
-#include "libxl_osdeps.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <assert.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
 
 #include "libxl_internal.h"
 
index a4725fea32172d790894f14316dd872d9156ce72..91643a26b29f7c8aa2c29a945d40cb0abaf7511d 100644 (file)
  * GNU Lesser General Public License for more details.
  */
 
-#include "libxl_osdeps.h"
+#include "libxl_osdeps.h" /* must come before any other headers */
 
-#include <stdio.h>
-#include <assert.h>
 #include <glob.h>
-#include <inttypes.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/time.h> /* for struct timeval */
-#include <sys/stat.h> /* for stat */
-#include <unistd.h> /* for sleep(2) */
 
 #include <xenctrl.h>
 #include <xc_dom.h>
 #include <xenguest.h>
-#include <fcntl.h>
 
 #include <xen/hvm/hvm_info_table.h>
 
index 52d40d13a01b5be0125f29eda0db6b2149dc1c51..b10e79f03d82e9b467370f08aa15fe0779b9d951 100644 (file)
  * GNU Lesser General Public License for more details.
  */
 
-#include "libxl_osdeps.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <assert.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <signal.h> /* for SIGKILL */
-#include <fcntl.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
 
 #include "libxl_internal.h"
 
index 6b548dd727d0d597eb78f2415697fab7c9814567..23f24766e9a80a9ebf88ac5f0e74942dc1029018 100644 (file)
@@ -7,13 +7,7 @@
  *  as published by the Free Software Foundation.
  */
 
-#include "libxl_osdeps.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <xenctrl.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
 
 #include "libxl_internal.h"
 
index cfa8c61bed9cd64a8c7625391a7ac3a9450fd106..49b0dabea72892cd76b625995825180a860cdeb0 100644 (file)
  * GNU Lesser General Public License for more details.
  */
 
-#include "libxl_osdeps.h"
-
-#include <stdio.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <unistd.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
 
 #include "libxl_internal.h"
 
index 01d8ca8cbbe779721ed0c84fe2dd0f00ab6c79d0..1b03929b2aefe381d5311e675aeea3b28ddd4c35 100644 (file)
 #ifndef LIBXL_INTERNAL_H
 #define LIBXL_INTERNAL_H
 
-#include "libxl_osdeps.h"
+#include "libxl_osdeps.h" /* must come before any other headers */
 
-#include <stdint.h>
+#include <assert.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <pthread.h>
+#include <signal.h>
 #include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <pthread.h>
+#include <unistd.h>
+
+#include <sys/mman.h>
+#include <sys/select.h>
+#include <sys/stat.h>
 #include <sys/time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
 
 #include <xs.h>
 #include <xenctrl.h>
+
 #include "xentoollog.h"
 
 #include <xen/io/xenbus.h>
index c0f869e1eb06a8d0abd5ba5218e03956f165f709..6ff2910806ec26b5626a047cfd4c66aabaea90bc 100644 (file)
  * GNU Lesser General Public License for more details.
  */
 
-#include "libxl_osdeps.h"
+#include "libxl_osdeps.h" /* must come before any other headers */
 
-#include <assert.h>
-#include <string.h>
 #include <math.h>
 
 #include <yajl/yajl_parse.h>
index 786c6b5f15b53f2228c4afc8f985128c687fb2f9..925248b8ff252fb2890f9cc8d6e44c11be231b79 100644 (file)
@@ -13,7 +13,7 @@
  * GNU Lesser General Public License for more details.
  */
  
-#include <sys/stat.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
 
 #include "libxl_internal.h"
  
index 1e8d6228358c7d431b18f0af69bfd1b53fa7a035..9e0ed6d95207d8b2524d98efae466e34708f9db6 100644 (file)
@@ -13,7 +13,7 @@
  * GNU Lesser General Public License for more details.
  */
  
-#include <sys/stat.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
 
 #include "libxl_internal.h"
 
index 3307551b2cec0f5d1b50705758c5fc7111aa6019..246b0de63b4be75b8cb3d9309f93bb9c05609463 100644 (file)
@@ -12,6 +12,8 @@
  * GNU Lesser General Public License for more details.
  */
 
+#include "libxl_osdeps.h" /* must come before any other headers */
+
 #include "libxl_internal.h"
 
 int libxl__blktap_enabled(libxl__gc *gc)
index 2e9490cd1ca9a0dcb2235ce3acb9e78edec33954..9e52f8d1cd3386d83f5219bb927bc5bd5904d44b 100644 (file)
@@ -10,6 +10,8 @@
  * GNU Lesser General Public License for more details.
  */
 
+#include "libxl_osdeps.h" /* must come before any other headers */
+
 #include "libxl_internal.h"
 
 void libxl_cpuid_destroy(libxl_cpuid_policy_list *p_cpuid_list)
index e7bd1a25fedaacadbf96391503cfa3dbbf975a18..a95d29f1993ec959d82e11ad6ab4afa8c43c106b 100644 (file)
@@ -12,6 +12,7 @@
  * GNU Lesser General Public License for more details.
  */
 
+#include "libxl_osdeps.h" /* must come before any other headers */
 #include "libxl_internal.h"
 #include "_libxl_paths.h"
 
index 8b2a1c5b770ef8d52d6824a21a19d396fa5899d5..c3828f6068b8842a92b1d70c708bee685088943b 100644 (file)
  * GNU Lesser General Public License for more details.
  */
 
-#include "libxl_osdeps.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/select.h>
-#include <sys/mman.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-#include <signal.h>
-#include <unistd.h> /* for write, unlink and close */
-#include <inttypes.h>
-#include <dirent.h>
-#include <assert.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
 
 #include "libxl_internal.h"
 
index 3dfa43a366d36450650cfc9366666fa3415110b4..61d976932bd7a5fdb56fc016b3c3889a06b6d02c 100644 (file)
  * Specification, see in the QEMU repository.
  */
 
-#include "libxl_osdeps.h"
+#include "libxl_osdeps.h" /* must come before any other headers */
 
-#include <unistd.h>
 #include <sys/un.h>
 #include <sys/queue.h>
-#include <fcntl.h>
 
 #include <yajl/yajl_gen.h>
 
index d36c737e9bcf7d03addbe2c3b0b6052984abab88..dbe8891ee9e297a99fc0d3d7aa01a958c4a5b5d0 100644 (file)
  * GNU Lesser General Public License for more details.
  */
 
-#include "libxl_osdeps.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include <xs.h>
-#include <xenctrl.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
+
 #include <ctype.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <assert.h>
 
 #include "libxl_internal.h"
 
index 80ab789c8f07ee4a240bb371a29c20b93bee2e9e..7c18d719da621471a2ce85e3eec64805bae58fa2 100644 (file)
@@ -12,7 +12,7 @@
  * GNU Lesser General Public License for more details.
  */
 
-#include "libxl_osdeps.h"
+#include "libxl_osdeps.h" /* must come before any other headers */
 
 #include <libxl_uuid.h>
 
index f3d4c8e60acad648c38a45886dba8855f6a40bd1..3ea8d088614def6852425cae50104413854ae662 100644 (file)
  * GNU Lesser General Public License for more details.
  */
 
-#include "libxl_osdeps.h"
-
-#include <string.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <inttypes.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
 
 #include "libxl_internal.h"
 
index 0d1c5d385a67766b1e5a54a2ae76c9a9698db4c1..e3659c7654596065afd379ac4d74ab1060685890 100644 (file)
@@ -16,6 +16,8 @@
  */
 
 
+#include "libxl_osdeps.h" /* must come before any other headers */
+
 #include <limits.h>
 
 #include "libxlu_internal.h"
index ea6a326f529cdbe1977fdf6b8532ade7e3d137d3..54d033c9a472fd136edf142ec1791c4194190fd0 100644 (file)
@@ -18,6 +18,7 @@
 #ifndef LIBXLU_CFG_I_H
 #define LIBXLU_CFG_I_H
 
+#include "libxl_osdeps.h" /* must come before any other headers */
 #include "libxlu_internal.h"
 #include "libxlu_cfg_y.h"
 
index 88b79acc4ba937480dc8cb22dcd5d83d32343959..6cd86e94bcc8931319e0d3c3c7bb49622241ee07 100644 (file)
@@ -1,3 +1,4 @@
+#include "libxl_osdeps.h" /* must come before any other headers */
 #include "libxlu_internal.h"
 #include "libxlu_disk_l.h"
 #include "libxlu_disk_i.h"
index 4fccd4a2e5b21325a00c130e276f0e796b533c3d..37246f22bf862c6a1079880ee6a6c6508fa249d1 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef LIBXLU_DISK_I_H
 #define LIBXLU_DISK_I_H
 
+#include "libxl_osdeps.h" /* must come before any other headers */
+
 #include "libxlu_internal.h"